<template>
    <div class="box">
        <text class="test">{{msg}}</text>
        <text class="test1">{{msgu}}</text>
        <text>{{msgz}}</text>
        <text class="test2">&#xe74b;</text>
        <image src="http://127.0.0.1:8080/api/images/test.png" class="img"></image>

        <div class="main">
            <div class="child-box box1" @click="clicked">
                <text>box1</text>
            </div>
            <div class="child-box box2">
                <text>box2</text>
            </div>
        </div>

    </div>
</template>

<style scoped>
    .box{
        background-color: #0af;
    }
    .test{
        color: #fff;
        font-size: 30px;
    }
    .test1{
        color: #000;
        font-family:myfont;
        text-align: right;
    }
    .test2{
        font-family: iconfont;
        color: #000;
    }
    .img{
        width: 375px;
        height: 200px;
    }
    .main{
        flex-direction: row;
    }
    .child-box{
        width: 375px;
        height: 200px;
    }
    .box1{
        background-color: #fff;
        justify-content: center;
        align-items: center;
    }
    .box2{
        background-color: #ff0;
    }
</style>

<script>
    // 全局变量
    var self;
    const dom = weex.requireModule('dom');
    var modal;
    module.exports = {
        //动态数据属性
        data : function () {
            return {
              msg:'hello',
              msgu:'ياخشىمۇسىز باشلىق',
              msgz:'你好',
            }
        },
        //公开数据属性
        props : {
           // lang: {
           //     default: 'ug'
           // },
        },
        //组件头文件导入
        components: {
            // fix_loading: require('../fix_loading/fix_loading.vue')
        },
        //组件实例创建完成，属性已绑定，但DOM还未生成
        created() {
            self = this;
            modal = weex.requireModule('uyghurmodal');
            dom.addRule('fontFace', {
                'fontFamily': "myfont",
                'src': "url(" + self.gFontUrl + ")"
            });

            var icon_font = self.gIconFontUrl;
            dom.addRule('fontFace', {
                'fontFamily': "iconfont",
                'src': "url('" + icon_font + "')"
            });

            self.getData();

        },
        //方法，函数
        methods: {
            clicked(){
                console.log('test');
            },
            getData(){
                // var url = '/v1/search/hot-search';
                var url = '/address/city-area';
                self.gGetData(url, res =>{
                    console.log('--------------------');
                    console.log(res);
                    if(res.ok){//请求成功
                        if (res.data.status == 200) {
                           
                        }else if(res.data.status == 401) {
                            console.log('login');
                        }else {
                            console.log(res.data.msg);
                        }
                    }else{//请求失败
                        console.log('-------fail-------');
                    }
                });
            }
        }
    }
</script>
